-module(my_list).
-compile(export_all).

head([H|_]) -> H.

sum([]) -> 0;
sum([H|T]) -> H + sum(T).

len([])->0;
len([H|T]) -> 1+ len(T).

% map(_Op, []) ->[];
% map(Op, [H|T]) -> [Op(H) | ].


map(Op) ->
        fun([]) -> 0;
        fun([H|T]) ->[Op(H)|(map(Op))(T)]
        end.
   
double(L)->(map(fun(I)-> I*2 end))(L).

add_1(L)->(map(fun(I)-> I+1 end))(L).

